<template>
  <div class="search-item">
    <div class="search-item-wrap" @click="onClick">
      <div class="search-icon-wrap">
        <div class="search-icon">
          <van-icon name="apps-o" color="rgba(0,0,0,.5)" size="16px"></van-icon>
        </div>
      </div>
      <div class="search-item-info">
        <div class="search-item-title">{{ title }}</div>
        <div class="search-item-subtitle">{{ subTitle }}</div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "searchItem",
    props: {
      title: String,
      subTitle: String,
      icon: String
    },
    methods: {
      onClick() {
        this.$emit("onClick");
      }
    }
  };
</script>

<style lang="less" scoped>
  .search-item {
    .search-item-wrap {
      display: flex;
      padding: 12px 15px 12px 15px;
      box-sizing: border-box;
      .search-icon-wrap {
        margin-right: 10px;
        .search-icon {
          display: flex;
          justify-content: center;
          align-items: center;
          width: 32px;
          height: 32px;
          background: #F7F7F9;
          border-radius: 50%;
        }
      }
      .search-item-info {
        width: 80%;
        .search-item-title {
          width: 100%;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          font-size: 14px;
          color: #333333;
        }
        .search-item-subtitle {
          font-size: 12px;
          color: rgba(0, 0, 0, 0.45);
        }
      }
    }
  }
</style>
